// EquipmentItem.cs
using UnityEngine;
using System.Collections.Generic;

[System.Serializable]
public class EquipmentItem : BaseItem
{

    [Header("装备属性")]
    public EquipmentType equipmentType;
    public CharacterClass requiredClass;
    public List<ItemAffix> affixes = new List<ItemAffix>();

    [Header("武器专属")]
    public WeaponType weaponType;
    public float attackSpeed = 1.0f;

    [Header("护甲专属")]
    public ArmorSlot armorSlot;

    [Header("饰品专属")]
    public UniqueEffect uniqueEffect;

    public override string GetTooltipText()
    {
        string tooltip = $"<b>{displayName}</b>\n{description}\n";
        tooltip += $"类型: {equipmentType}\n";

        switch (equipmentType)
        {
            case EquipmentType.WEAPON:
                tooltip += $"武器类型: {weaponType}\n";
                tooltip += $"攻击速度: {attackSpeed}/s\n";
                break;

            case EquipmentType.ARMOR:
                tooltip += $"部位: {armorSlot}\n";
                break;

            case EquipmentType.ACCESSORY:
                tooltip += $"特殊效果: {uniqueEffect}\n";
                break;
        }

        if (requiredClass != CharacterClass.NONE)
            tooltip += $"职业限制: {requiredClass}\n";

        tooltip += "属性:\n";
        foreach (var affix in affixes)
        {
            tooltip += $"- {GetAffixDescription(affix)}\n";
        }

        return tooltip;
    }

    private string GetAffixDescription(ItemAffix affix)
    {
        return $"+{affix.value} {affix.type}";
    }
}
